﻿@using Topro.Entity.Enum;
@{
    Layout = "~/Views/Shared/_Dialog.cshtml";
}
@model Topro.Entity.Response.Inventory.InventoryResponse
<section class="container-fluid case" style="background-color: white;">
    <form class="form-horizontal m15_t" id="form">
        <div class="tab-content">
            <input type="hidden" id="Id" name="Id" value="@(Model.Id)">
            <div class="tab-pane fade in active" id="home">
                <div class="form-group">
                    <label class="wd100 control-label"><span class="WdateFmtErr">*</span>物料名称：</label>
                    <div class="wd400 m15_l">
                        <input class="form-control" type="text" name="productName" maxlength="40" value="@(Model.ProductName)" autocomplete="off">
                    </div>
                </div>
                <div class="form-group">
                    <label class="wd100 control-label"><span class="WdateFmtErr">*</span>料号：</label>
                    <div class="wd400 m15_l">
                        <input class="form-control" type="text" name="partNo" maxlength="40" value="@(Model.PartNo)" autocomplete="off" >
                    </div>
                </div>
                <div class="form-group">
                    <label class="wd100 control-label"><span class="WdateFmtErr">*</span>数量：</label>
                    <div class="wd400 m15_l">
                        <input class="form-control" type="text" name="qty" maxlength="40" value="@(Model.Qty)" autocomplete="off">
                    </div>
                </div>
                <div class="form-group">
                    <label class="wd100 control-label"><span class="WdateFmtErr">*</span>批号：</label>
                    <div class="wd400 m15_l">
                        <input class="form-control" type="text" name="lotNo" maxlength="40" value="@(Model.LotNo)" autocomplete="off">
                    </div>
                </div>
                <div class="form-group">
                    <label class="wd100 control-label"><span class="WdateFmtErr">*</span>备注：</label>
                    <div class="wd400 m15_l">
                        <input class="form-control" type="text" name="remark" maxlength="40" value="@(Model.Remark)" autocomplete="off" placeholder="长度必须介于 0 和 40 之间">
                    </div>
                </div>
            </div>
        </div>
    </form>
</section>
@section footerScript{
    <script type="text/javascript">

        function save() {
            var data = $("#form").serializeJSON();

            var cover = Topro.UI.Mask({
                obj: $("body"),
                opacity: 0.5
            });

            Topro.Util.Ajax({
                type: "POST",
                url: "/Inventory/Save",
                data: data,
                success: function(res) {
                    if (res.success) {
                        cover.Remove();
                        Topro.UI.DialogOpener().Tip_success("操作成功！");
                        Topro.UI.DialogOpener().In.search();
                        Topro.UI.CloseDialog();
                    } else {
                        cover.Remove();
                        Topro.UI.Tip_short_warning("操作失败！" + res.message);
                    }
                },
                error: function(json) {
                    cover.Remove();
                    Topro.UI.Tip_warning("操作失败！请查看网络，请重试。");
                }
            });
        }
    </script>
}